Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Scoped clusters #7039

Merged
merged 25 commits into from
Aug 25, 2021
Merged

feat: Scoped clusters #7039

merged 25 commits into from
Aug 25, 2021

Conversation

pasha-codefresh
Copy link
Member

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).

plakyda1 and others added 20 commits August 9, 2021 14:37
Signed-off-by: Victor Plakyda <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: Victor Plakyda <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: Victor Plakyda <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: Victor Plakyda <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
# Conflicts:
#	ui/src/app/applications/components/application-retry-options/application-retry-options.tsx
#	ui/src/app/applications/components/applications-sync-panel/applications-sync-panel.tsx
#	ui/src/app/shared/models.ts
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
@pasha-codefresh pasha-codefresh changed the title Scoped clusters feat: Scoped clusters Aug 24, 2021
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
Signed-off-by: pashavictorovich <[email protected]>
@codecov
Copy link

codecov bot commented Aug 24, 2021

Codecov Report

Merging #7039 (731c562) into master (c7e5329) will increase coverage by 0.00%.
The diff coverage is 19.64%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7039   +/-   ##
=======================================
  Coverage   41.07%   41.07%           
=======================================
  Files         158      158           
  Lines       21305    21341   +36     
=======================================
+ Hits         8750     8766   +16     
- Misses      11303    11313   +10     
- Partials     1252     1262   +10     
Impacted Files Coverage Δ
cmd/argocd/commands/cluster.go 5.91% <0.00%> (-0.06%) ⬇️
cmd/util/cluster.go 39.39% <0.00%> (-0.61%) ⬇️
pkg/apis/application/v1alpha1/types.go 57.87% <ø> (ø)
server/project/project.go 52.69% <0.00%> (-0.21%) ⬇️
server/cluster/cluster.go 22.87% <18.18%> (+5.32%) ⬆️
util/argo/argo.go 62.75% <26.66%> (-1.05%) ⬇️
util/db/cluster.go 59.06% <33.33%> (-0.46%) ⬇️
util/settings/settings.go 47.38% <0.00%> (-0.27%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7e5329...731c562. Read the comment docs.

@@ -421,6 +435,10 @@ func GetAppProjectByName(name string, projLister applicationsv1.AppProjectLister
for _, repo := range repos {
project.Spec.SourceRepos = append(project.Spec.SourceRepos, repo.Repo)
}
clusters := retrieveScopedClusters(name, db, ctx)
for _, cluster := range clusters {
project.Spec.Destinations = append(project.Spec.Destinations, argoappv1.ApplicationDestination{Server: cluster.Server, Namespace: "*"})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cluster might be connected in a "namespaced" mode - cluster.Namespaces is not empty. In this case only these namespaces should be auto-added to the destination. E.g.

if len(cluster.Namespaces) == 0 {
  project.Spec.Destinations = append(project.Spec.Destinations, argoappv1.ApplicationDestination{Server: cluster.Server, Namespace: "*"})
} else {
  for _, ns := range cluster.Namespaces { 
    project.Spec.Destinations = append(project.Spec.Destinations, argoappv1.ApplicationDestination{Server: cluster.Server, Namespace: ns})
  }
}

Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @pasha-codefresh ! Found only one minor issue and it is ready to go

Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexmt alexmt merged commit 49a854a into argoproj:master Aug 25, 2021
@sbose78
Copy link
Contributor

sbose78 commented Aug 31, 2021

Sorry, is there a PR description or an issue I could read up ? :(

@alexmt
Copy link
Collaborator

alexmt commented Sep 2, 2021

hello @sbose78 . Sure, here it is: #5283. We also discussed implementation in the proposal: https://github.com/argoproj/argo-cd/blob/master/docs/proposals/project-repos-and-clusters.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants